<template>
	<view class="my-modal" v-if="show">
		<view class="box-mask" @click="fail"></view>
		<view class="modal-body">
			<view class="uni-modal__hd b-b"><strong class="uni-modal__title">附近的网点</strong></view>
			<view class="uni-modal__bd">
				<view class="store_list">
					<view class="store_item d-flex b-b" v-for="item,index in store" :key="index">
						<view class="icon">
							<image class="item-image" src="../../static/image/location.png" mode="aspectFill" />
						</view>
						<view class="store-body">
							<view class="store">
								{{ item.storeName }}
							</view>
							<view class="d-flex store-ad-distance">
								<view class="store_address">
									{{ item.address }}
								</view>
								<view class="distance">
									{{ item.distance }} m
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="uni-modal__ft">
				<button class="uni-modal__btn uni-modal__btn_default" style="color: rgb(0, 0, 0);" @click="fail">取消</button>
				<button class="uni-modal__btn uni-modal__btn_primary" style="color: rgb(0, 122, 255);" @click="success">确定</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			show:{
				type: Boolean,
				default: false
			},
			title: {
				type: String,
				default: '附近的网点'
			},
			store:{
				default:[]
			}
		},
		methods: {
			success(){
				this.$emit('update:show', false);
			},
			fail(){
				this.$emit('update:show', false);
			}
		},
		mounted() {
			// console.log('store',this.store)
		}
	}
</script>

<style lang="scss" scoped>
	.b-b{
		position: relative;
		
		&:after{
			position: absolute;
			z-index: 3;
			left: 0;
			top: auto;
			bottom: 0;
			right: 0;
			height: 0;
			content: '';
			transform: scaleY(.5);
			border-bottom: 1px solid #d4d4d4;
		}
	}
	.my-modal{
		width:100%;
		height:100vh;
		position:fixed;
		top:0;
	}
	.d-flex{
		display: flex;
	}
	.box-mask {
		width: 100%;
		height: 100%;
		background: #000;
		opacity: 0.2;
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 199;
	}
	.modal-body{
		position: fixed;
		z-index: 999;
		width: 80%;
		max-width: 300px;
		top: 50%;
		left: 50%;
		transform: translate(-50%,-50%);
		background-color: #fff;
		text-align: center;
		border-radius: 10px;
		overflow: hidden;
		box-sizing:border-box;
		.uni-modal__hd{
			padding:1em 1.6em .3em;
		}
		.uni-modal__title{
			word-break: break-all;
			white-space: pre-wrap;
			font-weight: 400;
			font-size: 18px;
			overflow: hidden;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-line-clamp: 2;
			-webkit-box-orient: vertical
		}
		.uni-modal__bd{
			// padding: 1.3em 1.6em 1.3em;
			padding: 1em;
			min-height: 40px;
			font-size: 15px;
			line-height: 1.4;
			color: #999;
			max-height: 400px;
			overflow-x: hidden;
			overflow-y: auto;
			word-break: break-all;
			white-space: pre-wrap;
			
			
			.store_item{
				box-sizing: border-box;
				align-items:center;
				.icon{
					flex-basis: 20%;
					align-items: center;
					display: flex;
					.item-image{
						width: 3rem;
						height: 3rem;
						padding: 15rpx;
					}
				}
				.store-body{
					box-sizing: border-box;
					white-space: nowrap;
					overflow: hidden;
					padding: 10rpx;
					flex-basis: 80%
				}
				.store,.store_address{
					overflow: hidden;
					text-overflow: ellipsis;
					font-size: .7rem;
				}
				.store{
					color: #000;
					font-weight: bold;
					font-size: .8rem;
				}
				.distance{
					font-size: .7rem;
				}
				.store-ad-distance{
					justify-content: space-between;
				}
			}
		}
		.uni-modal__ft{
			display: flex;
			box-sizing:border-box;
			border-top:1px solid #ccc;
		}
		.uni-modal__btn{
			display: block;
			flex: 1;
			text-decoration: none;
			-webkit-tap-highlight-color: rgba(0,0,0,0);
			position: relative;
			line-height: 48px;
			cursor: pointer;
			font-size: 18px;
		}
		.uni-modal__btn_primary{
			color: rgb(0, 122, 255);
			// -webkit-tap-highlight-color: rgba(0,0,0,0);
		}
		.uni-modal__btn:after{
			content: " ";
			position: absolute;
			left: 0;
			top: 0;
			width: 1px;
			bottom: 0;
			border-left: 1px solid #d5d5d6;
			color: #d5d5d6;
			transform-origin: 0 0;
			transform: scaleX(.5);
		}
		
	}
</style>
